var that;
const app=getApp();
var ipUrl=app.globalData.ipUrl;
Page({
  
  data: {
    show: false,
    couCDKEY:'',
  },

  onClickShow() {
    this.setData({ show: true });
  },

  onClickHide() {
    this.setData({ show: false });
  },

  noop() {},
    youhuiquan:function(e){
      that.data.couCDKEY=e.detail.value
    }, 
    oks:function(){
      that=this;
      console.log(that.data.couCDKEY)
      wx.request({
        url: "http://localhost:8080/coupon/addCoumiddle",
        data: {
          couCDKEY:that.data.couCDKEY,
          userid: 1
        },
        header: {
          'content-type': 'application/json' // 默认值
        },
        success (res) {
           console.log(res.data)
          that.setData({
             coupon1:res.data.data
            
          })
          if(res.data.data==true){
            that.setData({ show: false });
          }     
        }
      })
    },
    onLoad: function () {
      that=this;
           wx.request({
            url:'http://localhost:8080/coupon/queryCoumiddle?userid='+1, //仅为示例，并非真实的接口地址
            header: {
              'content-type': 'application/json' // 默认值
            },
            success (res) {
              that.setData({
                    coupon2:res.data
              });
            },
            fail(e){
              console.log("失败")
            }
          })
        },

});